﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;

namespace FakeGUI
{
    public partial class Form_NewSEGM : Form
    {
        /// <summary>
        ///构造函数
        /// </summary>
        public Form_NewSEGM()
        {

            InitializeComponent();
            SetDefaultPath();
        }
        //字段：新建的地图路径
        private string _NewMapPath;
        //属性：新建的地图路径
        public string NewMapPath
        {
            get
            {
                return _NewMapPath;
            }
        }

        //控件事件：地图名更改、路径选择

        private void TextBox_MapName_TextChanged(object sender, EventArgs e)
        {
            RefreshMapPath();
        }
        private void Button_EditPath_Click(object sender, EventArgs e)
        {
            FolderBrowserDialog PathTransporter = new FolderBrowserDialog();
            if (PathTransporter.ShowDialog() == DialogResult.OK)
            {
                TextBox_Path.Text = PathTransporter.SelectedPath;
                RefreshMapPath();
            }
            PathTransporter.Dispose();
        }
        //私有函数：设置默认路径、更新路径
        private void SetDefaultPath()
        {
            _NewMapPath = Application.StartupPath + "\\DefaultMaps";
            TextBox_Path.Text = _NewMapPath;
        }
        private void RefreshMapPath()
        {
            _NewMapPath = TextBox_Path.Text +"\\"+TextBox_MapName.Text;
        }


    }
}
